package com.hzsun.rocketmq.spring.controller;

import com.hzsun.rocketmq.spring.producer.RocketMQProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.UnsupportedEncodingException;

/**
 * @Author: DingJl
 * @Date: 2022/1/22 16:47
 * @Version 1.0
 */
@RestController
public class TransactionListenerController {
    @Autowired
    private RocketMQProducer rocketMQProducer;

    @GetMapping("/transaction")
    public String msg() {
        try {
            rocketMQProducer.sendTranstionMsg("topic-test","tagA",null,"msg");;
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        System.out.println("######################");

        return "success";
    }
}
